@extends('admin.layout.base')

@section('content')
    <div class="layui-card-body">
        <div class="layui-form" lay-filter="">
            <form class="layui-form" data-url="{{route('admin.update')}}">
                {{csrf_field()}}
                <input type="hidden" name="id" value="{{$data['id']}}">

                <div class="layui-form-item">
                    <label class="layui-form-label">我的角色</label>
                    <div class="layui-input-block" id="roles" data-roles="{{$data['roles']}}"
                         data-old="{{$data['admin_roles']}}"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" value="{{$data['name']}}" lay-verify="nickname"
                               autocomplete="off" class="layui-input checkOnly" data-table="Admin">
                    </div>
                    <div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline">
                        <input type="password" name="password" value="{{$data['password']}}" lay-verify="pass"
                               lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">6到16个字符</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="phone" value="{{$data['phone']}}" lay-verify="phone" autocomplete="off"
                               class="layui-input checkOnly" data-table="Admin">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email" value="{{$data['email']}}" lay-verify="email" autocomplete="off"
                               class="layui-input checkOnly" data-table="Admin">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="status" value="0" title="启用" {{$data['status']==0?'checked':''}}>
                        <input type="radio" name="status" value="1" title="停用" {{$data['status']==1?'checked':''}}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-inline">
                        <input name="logo" lay-verify="required" id="img_url" placeholder="图片地址" value="{{$data['logo']}}" class="layui-input">
                    </div>
                    <div class="layui-input-inline layui-btn-container" style="width: auto;">
                        <a type="button" class="layui-btn layui-btn-primary uploadImg">
                            <i class="layui-icon"></i>上传图片
                        </a>
                    </div>
                </div>

                {{--<div class="layui-form-item">
                    <label class="layui-form-label">文件</label>
                    <div class="layui-input-inline">
                        <input name="logo" lay-verify="required" id="file_url" placeholder="文件地址" value="{{$data['logo']}}" class="layui-input">
                    </div>
                    <div class="layui-input-inline layui-btn-container" style="width: auto;">
                        <a type="button" class="layui-btn layui-btn-primary uploadFile">
                            <i class="layui-icon"></i>上传文件
                        </a>
                    </div>
                </div>--}}

                {{--<div class="layui-form-item">
                    <label for="L_alias" class="layui-form-label">log</label>
                    <div class="layui-input-inline">
                        <img class="layui-upload-img uploadImg" src="admin/images/upimg.png" height="100" width="150">
                        <input type="hidden" name="logo" value="" lay-verify="pic_log" id="img_url">
                    </div>
                </div>--}}

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="submitIng">提 交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection

@section('script')
    <script src="/static/admin/layuiadmin/modules/set.js"></script>
    <script>
        layui.use(['layer', 'jquery', 'selectM', 'upload'], function () {
            $ = layui.jquery;
            var selectM = layui.selectM;
            var tagData = $('#roles').data('roles');
            var selected = $('#roles').data('old');

            selectM({
                elem: '#roles'//元素容器【必填】
                , data: tagData//候选数据【必填】
                , selected: selected
                , name: 'roles'
                , width: 500
                , verify: 'required'//添加验证
            });

        });
    </script>
@endsection